﻿var curenTiNT = 0;
$(document).ready(function (e) {
    resizeBank4();
    $(window).resize(function () {
        resizeBank4();
    })
    $(".serveAppBk5_ul li a").hover(function () {
        $(this).find("span").stop().animate({ bottom: 0 }, 300, "easeInOutCubic");
    }, function () {
        $(this).find("span").stop().animate({ bottom: -30 }, 300, "easeInOutCubic");
    })
    $(".AppBk5dianNUm span").removeClass("curnsdscss").eq(curenTiNT).addClass("curnsdscss");
    $(".AppBk5dianNUm span").click(function () {
        var curssax = $(".AppBk5dianNUm span").index(this);
        animatdds(curssax);
    })

    /////////////手势滑动///////////
    /*$(".serveAppBk5_ul").on("swipeleft",function(){
    var curssax=curenTiNT+1;
    animatdds(curssax);
    });
    $(".serveAppBk5_ul").on("swiperight",function(){
    var curssax=curenTiNT-1;
    animatdds(curssax);
    });
    */
    var setInjisdsa;
    var bolltsAsTime = true;
    $(".serveAppBk5_ul").bind("swipeleft swipeleftdown swipeleftup", function () {
        if (bolltsAsTime) {
            var curssax = curenTiNT + 1;
            animatdds(curssax);
            bolltsAsTime = false;
            clearTimeout(setInjisdsa);
            setInjisdsa = setTimeout(bolltsAsTimehs, 300);
        }

    });
    $(".serveAppBk5_ul").bind("swiperight swiperightup swiperightdown", function () {
        if (bolltsAsTime) {
            var curssax = curenTiNT - 1;
            animatdds(curssax);
            bolltsAsTime = false;
            clearTimeout(setInjisdsa);
            setInjisdsa = setTimeout(bolltsAsTimehs, 300);
        }
    });
    function bolltsAsTimehs() {
        bolltsAsTime = true;

    }




});


function animatdds(curssax) {
    if (curssax > curenTiNT) {
        $(".serveAppBk5_ul li").eq(curssax).stop().css({ left: $(window).width() }).animate({ left: 0 }, 500, "easeInOutCubic");
        $(".serveAppBk5_ul li").eq(curenTiNT).stop().css({ left: 0 }).animate({ left: -$(window).width() }, 500, "easeInOutCubic");
        curenTiNT = curssax;
    }

    if (curssax < curenTiNT) {
        $(".serveAppBk5_ul li").eq(curssax).stop().css({ left: -$(window).width() }).animate({ left: 0 }, 500, "easeInOutCubic");
        $(".serveAppBk5_ul li").eq(curenTiNT).stop().css({ left: 0 }).animate({ left: $(window).width() }, 500, "easeInOutCubic");
        curenTiNT = curssax;
    }
    $(".AppBk5dianNUm span").removeClass("curnsdscss").eq(curenTiNT).addClass("curnsdscss");

}

function resizeBank4() {
    $(".serveAppBk5_ul").height($(".serveAppBk5_ul li").eq(0).height());
    $(".serveAppBk5_ul li").each(function (index, element) {
        if (index != curenTiNT) {
            $(this).css("left", $(window).width());
        } else {
            $(this).css("left", 0);
        }
    });

}